perm filename TEMP[TIM,LSP]1 blob sn#717371 filedate 1983-06-26 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	Timings
C00005 ENDMK
C⊗;
Timings

Folks, in place of SCCPP, please substitute the following 2 variations on
TAK. One does catch/throw, the other special binding in place of parameter
passing. These are simpler than SCCPP and test moe important things.

			-rpg-

;;; Begin CTAK
(declare 
 (fixnum (tak fixnum fixnum fixnum)))

(defun tak (x y z)
 (*catch 'tak (tak1 x y z)))

(defun tak1 (x y z)
       (cond ((not (< y x))	;x≤y
	      (*throw 'tak z))
	     (t (tak1
		 (*catch 'tak
			 (tak1 (1- x)
			       y
			       z))
		 (*catch 'tak
			 (tak1 (1- y)
			       z
			       x))
		 (*catch 'tak
			 (tak1 (1- z)
			       x
			       y))))))

(include "timer.lsp")
(timer timit (tak 18. 12. 6.))
;;; End CTAK

;;; Begin STAK
(declare 
 (fixnum (tak fixnum fixnum fixnum))
 (fixnum (stak))
 (special x y z)
 (fixnum x y z))

(defun tak (x y z)
  (stak))

(defun stak ()
       (cond ((not (< y x))	;x≤y
	      z)
	     (t (let ((x (let ((x (1- x))
			       (y y)
			       (z z))
			      (stak)))
		      (y (let ((x (1- y))
			       (y z)
			       (z x))
			      (stak)))
		      (z (let ((x (1- z))
			       (y x)
			       (z y))
			      (stak))))
		     (stak)))))

(include "timer.lsp")
(timer timit (tak 18. 12. 6.))
;;; End STAK